  <div id="border">
  <form action="<?=site_url("property/update_property")?>" method="post" enctype="multipart/form-data">
  <div class="property_line_ccc"></div>
  <div style="background:url(<?=base_url();?>images/bg_propeties.jpg); width:980px; height:266px; color:#FFF; font-family:Arial, Helvetica, sans-serif;">
	
	<? include APPPATH."views/templates/common/property_search.php";?>
			<a class="property_ads" href="<?=site_url("property")?>"><div>View ads Property</div></a>
          </div>
		 <div style="background:#BD2031; height:2px;"></div>
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
             <tr>
             <td valign="top">       
                <table width="99%" border="0" align="center" id="usertitle">
                  <tr>
                    <td width="29%"><h3><b>Edit Property<b></h3></td>
					<td width="32%" align="center"><span class="success_message"><? if(isset($success_message)) {echo $success_message;}?></span></td>
                    <td align="right"><img src="<?=base_url();?>images/Secure_connection.gif" alt="" width="116" height="22" /></td>
                  </tr>
                </table>
                <div id="content">
                <div class="user_line_border_top"></div>
                   
        			    <?php if(isset($message_errors)){?><div class="error_message" style="color:#BD2031; font-size:11px; line-height:20px;"><?=$message_errors;?></div><? }?>
                          <table width="86%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr>
                              <td align="right" class="ttd">Title:</td>
                              <td class="ttd">
                                <div class="bordrTextbox"><input name="txtTitle" type="text" class="textbox" id="txtTitle" value="<?=(isset($_POST['txtTitle']) ? set_value('txtTitle') : $get_property["property_name"])?>" maxlength="39" /></div>
                              </td>
                            </tr>
                             <tr>
                              <td align="right" class="ttd">Location:</td>
                              <td class="ttd">
                              <div class="bordrTextbox"><span class="bordrTextbox" style="float:left; ">
                                <select name="cb_loc" size="0" class="textbox" mosreq="0" moslabel="City/Provinces" id="cb_loc">
                                  <?php 
                                   foreach($get_loc->result_array() as $rowGetLoc){
                                    $loc_id = isset($_POST['cb_loc']) ? set_value("cb_loc") : $get_property["location_id"];
                                    $selected = $rowGetLoc["location_id"]==$loc_id ? "selected" : "";?>
                                  	<option value="<?=$rowGetLoc["location_id"]?>" <?=$selected?>><?=$rowGetLoc["location_name"]?></option>
                                  <? }?>
                                </select>
                              </span></div>
                              <span style="color:#BD2031"></span>
                              </td>
                            </tr>
                            
                            <tr>
                              <td align="right" class="ttd" valign="top">Property Category:<span class="require">*</span></td>
                              <td class="ttd">
                                <div class="bordrTextbox" style="float:left; ">
                                  <select name="cbo_cat" size="0" class="textbox" mosreq="0" id="cbo_cat">
                                    <?php foreach($pro_cat->result_array() as $row) {
                                    	$cat_id = isset($_POST['cbo_cat']) ? set_value("cbo_cat") : $get_property["property_cat"];
                                	    $selected = $row["prop_cat_id"] == $cat_id ? "selected" : "";
                                	?>
                                     	<option value="<?=$row["prop_cat_id"]?>" <?=$selected?>><?=htmlspecialchars($row["prop_cat_name"])?></option>
                                	<?php } ?>
                                  </select>
                                </div>
                              </td>
                            </tr>
                            
                            <tr>
                              <td align="right" class="ttd" valign="top">Property Type:</td>
                              <td class="ttd">
                                <div class="bordrTextbox" style="float:left; ">
                                  <select name="cbo_type" size="0" class="textbox" mosreq="0" id="cbo_type">
                                     <?php 
                                        $type = isset($_POST["cbo_type"]) ? $_POST["cbo_type"] :  $get_property["property_type"];
                                        $selectedrent = $type=="rent" ? "selected" : "";
                                        $selectedsale = $type=="sale" ? "selected" : "";
                                        ?>
                                    <option value="sale" <?=$selectedsale?>>Sale</option>
                                    <option value="rent" <?=$selectedrent?>>Rent</option>
                                  </select>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td align="right" class="ttd">Floors:</td>
                              <td class="ttd">
									<table width="320" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td width="74">                              
                                        <div class="bordrTextbox" style="width:60px;">
                                        <select name="cbo_Floor" size="0" class="textbox" mosreq="0" moslabel="Flood" style="width:75px;" id="cbo_Floor">
                                          <? for($i=0; $i<=12; $i++) {
                                          	$floor_nb = isset($_POST["cbo_Floor"]) ? $_POST["cbo_Floor"] :  $get_property["no_of_floor"];
                                            $selected = $floor_nb==$i ? "selected" : "";
                                          ?>
                                          <option value="<?=$i?>" <?=$selected?>><?=$i?></option>
                                          <? }?>
                                        </select>
                                      	</div>
                                	  </td>
                                        <td width="66">Bedrooms:</td>
                                        <td width="144"> 
                                        <div class="bordrTextbox" style="width:60px;">
                                        <select name="cbo_Bedroom" size="0" class="textbox" mosreq="0" moslabel="Bedroom" style="width:75px;" id="cbo_Bedroom">
                                          <? for($i=0; $i<=12; $i++) {
                                          	$bedroom_nb = isset($_POST["cbo_Bedroom"]) ? $_POST["cbo_Bedroom"] :  $get_property["no_of_bedrooms"];
                                          	$selected = $bedroom_nb==$i ? "selected" : "";
                                          	?>
                                          <option value="<?=$i?>" <?=$selected?>><?=$i?></option>
                                          <? }?>
                                        </select>
                                        </div>
                                        </td>
                                      </tr>
                                    </table>

                              </td>
                            </tr>
                              <tr>
                              <td class="ttd" align="right">Baths:</td>
                              <td>
								<table width="320" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td width="74">                              
                                        <div class="bordrTextbox" style="width:60px;">
                                        <select name="cbo_bath" size="0" class="textbox" mosreq="0" moslabel="Flood" style="width:75px;" id="cbo_bath">
                                          <? for($i=0; $i<=12; $i++) {
                                          	 $bathroom_nb = isset($_POST["cbo_bath"]) ? $_POST["cbo_bath"] :  $get_property["no_of_bathroom"];
                                          	 $selected = $bathroom_nb==$i ? "selected" : "";?>
                                          <option value="<?=$i?>" <?=$selected?>><?=$i?></option>
                                          <? }?>
                                        </select>
                                      	</div>
                                	  </td>
                                        <td width="66">Parking:</td>
                                        <td width="144"><span class="bordrTextbox" style="width:60px;">
										<select name="cbo_parking" size="0" class="textbox" mosreq="0" moslabel="Bedroom" style="width:75px;" id="cbo_parking">
                                          <? for($i=0; $i<=12; $i++) {
                                          	 $parking_nb = isset($_POST["cbo_parking"]) ? $_POST["cbo_parking"] :  $get_property["parking"];
                                          	 $selected = $parking_nb==$i ? "selected" : "";?>
                                          <option value="<?=$i?>" <?=$selected?>><?=$i?></option>
                                          <? }?>
                                        </select>
                                        </span></td>
                                      </tr>
                              </table>
                              </td>
                            </tr>
                            <tr>
                              <td align="right" class="ttd">Features:</td>
                              <td class="ttd"><div class="bordrTextbox"><input name="txtFeatures" type="text" class="textbox" id="txtFeatures"  value="<?php if(isset($_POST['txtFeatures']))echo set_value('txtFeatures'); ?><?=$get_property["features"]?>" maxlength="100" /></div></td>
                            </tr>
                            <tr>
                              <td align="right" class="ttd">Description:</td>
                              <td align="left">
                                <textarea name="txtDesc" rows="5" class="textbox" id="txtDesc" maxlength=250 style="height:190px;width:225px;"><?php if(isset($_POST['txtDesc']))echo set_value('txtDesc'); ?><?=$get_property["description"]?></textarea>
                             </td>
                            </tr>
                           
                            <tr>
                              <td align="right" class="ttd">Property price</td>
                              <td><table cellpadding="0" cellspacing="0"><tr><td><div class="bordrTextbox"><input name="txtPrice" type="text" class="textbox" id="txtPrice" value="<?=(isset($_POST['txtPrice']) ? set_value('txtPrice') : $get_property["property_price"])?>" /></div></td><td style="color:#999;">&nbsp;</td></tr></table></td>
                            </tr>
                            
                            <tr>
                              <td align="right" class="ttd">Building Size:</td>
                              <td>
								<div class="bordrTextbox"><input name="txtBSize" type="text" class="textbox" id="txtBSize" value="<?=(isset($_POST['txtBSize']) ? set_value('txtBSize') : $get_property["b_size"])?>" maxlength="30" /></div>
                              </td>
                            </tr>
                            
                             <tr>
                              <td align="right" class="ttd">Land Size:</td>
                              <td>
								<div class="bordrTextbox"><input name="txtLSize" type="text" class="textbox" id="txtLSize" value="<?=(isset($_POST['txtLSize']) ? set_value('txtLSize'): $get_property["land_size"])?>" maxlength="30" /></div>
                              </td>
                            </tr>
                            <tr>
                                <td align="center"></td>
                                <td height="26"><font style="color:#999;">Image format: Jpeg, Jpg, Gif, or Png Size: 3MB</font></td>
                            </tr>
                            <tr>
                              <td align="right" valign="top" style="line-height:27px; padding-top:3px; padding-right:10px;">Picture 1:<br />Picture 2:<br />Picture 3:<br />Picture 4:<br />Picture 5:</td>
                              <td class="ttd">
								<input type="file" name="image1" value="<?php if(isset($_REQUEST['image1']))echo set_value('image1'); ?>" /><br />
                                      <input type="file" name="image2" value="<?php if(isset($_POST['image2']))echo set_value('image2'); ?>" /><br />
                                      <input type="file" name="image3" value="<?php if(isset($_POST['image3']))echo set_value('image3'); ?>" /><br />
                                      <input type="file" name="image4" value="<?php if(isset($_POST['image4']))echo set_value('image4'); ?>" /><br />
                                      <input type="file" name="image5" value="<?php if(isset($_POST['image5']))echo set_value('image5'); ?>" />
                                <script language="javascript">
									function submit_url(url){
										document.forms[0].action=url;
										document.forms[0].submit();
									}
								</script>
                                 <input name="txtID" type="hidden" value="<?=$get_property["property_id"]?>" /><br />
								 <?php //echo "<pre>"; var_dump($get_pic_id->result_array()); echo "</pre>";  
									foreach($get_pic_id->result_array() as $row_pic){?>
										<img src="<?=base_url();?><?=$get_property["file_path"];?><?=$row_pic['pic_name'];?>" width="36" align="middle" /> <?=$row_pic['pic_name'];?>&nbsp;<a href="<?=site_url("property/del_pic/".$get_property["property_id"]."/".$row_pic['pic_name'])?>">Delete</a><br />
								<? }?>
                              </td>
                            </tr>
                            <tr>
                              <td>&nbsp;</td>
                              <td height="50"><input type="button" value="Back" onclick="document.location='<?=site_url("users/profiles?type=".Zencryption::encrypt(serialize("properties")))?>'" /><input type="submit" name="btn_property" id="btn_property" value="Update Property" /></td>
                            </tr>
                            <tr>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                            </tr>
                          </table>
                
                </div>
                </td>
                <td width="254" valign="top">
                    <?php include APPPATH."views/templates/common/right_content.php"; ?>
                 </td>
                 
              </tr>
          </table>
        
        <!--Find report and location-->
		<? include APPPATH."views/templates/common/property_menu_bottom.php";?>

    </form>     
</div>
